<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <comp></comp>
    </div>

    <template id="comp_template">
        <h2>这是通过template标签创建出来的组件</h2>
    </template>

    <script>
        new Vue({
            el: "#app",
            components: {
                "comp": {
                    template: "#comp_template"
                }
            }
        })
    </script>
</body>
</html>